`ifndef FIFO_ENV__SV
`define FIFO_ENV__SV

//import uvm_pkg::*;
  //`include "uvm_macros.svh"
`include "fifo_agent.sv"
`include "fifo_refermodule.sv"

class fifo_env extends uvm_env;
  `uvm_component_utils(fifo_env)
  
  fifo_agent 			i_agt		;
  
  fifo_agent_out 		o_agt		; 
  
  fifo_refermodule 		fifo_mdl	;
  
  uvm_tlm_analysis_fifo#(fifo_transcation) agt2mdl_fifo; 
  
  function new(string name = "fifo_env",uvm_component parent);
    super.new(name,parent);
  endfunction
  
  virtual function void build_phase(uvm_phase phase);
    super.build_phase(phase);
	i_agt = fifo_agent::type_id::create("i_agt",this);
	o_agt = fifo_agent_out::type_id::create("o_agt",this);
	fifo_mdl = fifo_refermodule::type_id::create("fifo_mdl",this);
	agt2mdl_fifo = new("agt2mdl_fifo",this);
  endfunction
  
  /* virtual task main_phase(uvm_phase phase);
    fifo_sequence seq;
	phase.raise_objection(this);
	seq = fifo_sequence::type_id::create("seq");
	seq.start(i_agt.sqr);
	phase.drop_objection(this);
  endtask */
  
  virtual function void connect_phase(uvm_phase phase);
	super.connect_phase(phase);
	fifo_mdl.bg_port.connect(agt2mdl_fifo.blocking_get_export);
	i_agt.ap.connect(agt2mdl_fifo.analysis_export);
	//i_agt.ap.connect(fifo_mdl.a_imp);
  endfunction
endclass
`endif